/*********************************************************************\
*
*                  (c) lkc
*                  All Rights Reserved. lkc Confidential
*
\*********************************************************************/
/*********************************************************************\
*   Title                      :
*
*   Module Description         :
*
*   Author                     : lkc
*
*   Created                    : 2018-7-24
*
\*********************************************************************/

#ifndef PROTOCOLBASE_H
#define PROTOCOLBASE_H


//#include <vector>
#include <deque>
#include <memory>
#include "CommBase.h"

class ProtocolBase
{
public:
    ProtocolBase();
    virtual ~ProtocolBase()
    {}

    void SetCommTool(std::shared_ptr<CommBase>);
    std::shared_ptr<CommBase> GetCommTool();


    virtual void ExtractData(unsigned char* data,int nLength) = 0;//需要改成const的
    virtual int CycleSendOnce() = 0;
    void CycleSendThread();

protected:
    int Send(const unsigned char *sendBuf, const int dataLen);

private:
    virtual void EventReceiveFrameParse() = 0;

protected:
    std::deque<unsigned char> bufferTemp;

private:
    const int BUFFER_TEMP_SIZE = 1024;

    std::shared_ptr<CommBase> m_commTool;

};


#endif // PROTOCOLBASE_H


/********************************************************************\
 *
 * REVISION RECORDS
 *
\*********************************************************************/
/*********************************************************************/
/*
 *
 *
 *
\*********************************************************************/
/*------------------------------The End------------------------------*/
